using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class MyBooks : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e) 
    {
        if (!IsPostBack)
        {
            if (null != Membership.GetUser())
            {
                if (Roles.IsUserInRole(Membership.GetUser(true).UserName, "user"))
                {
                    string doit = "";
                    doit += 
                        "SELECT username, bookid, requestedbookid, requestid, title, substring(title,0,45) AS shortTitle";
                    doit += " FROM books, requests";
                    doit += " WHERE bookid = requestedbookid";
                    doit += " AND username = '" + Membership.GetUser(true).UserName + "'";

                    ((SqlDataSource)this.LoginViewUser.FindControl("SqlDataSource1")).SelectCommand = doit;
                    ((GridView)this.LoginViewUser.FindControl("GridView1")).DataBind();
                }
                //Response.Write(Membership.GetUser(true).UserName);
            }
        }
    }

}
